package com.example.usercenter.common;

public class ResultUtils {
    public static<T>  BaseResponse<T> success(T data){
        return new BaseResponse<T>(0,data,"ok");
    }

    public static<T>  BaseResponse<T> error(ErrorCode errorCode){
        return new BaseResponse<T>(errorCode.getCode(),null,errorCode.getMessage());
    }

    public static<T>  BaseResponse<T> error(ErrorCode errorCode,String Message,String description){
        return new BaseResponse<T>(errorCode.getCode(),null,description);
    }

    public static<T>  BaseResponse<T> error(ErrorCode errorCode,String description){
        return new BaseResponse<T>(errorCode.getCode(),null,description);
    }
}
